#include "player.h"

polaris::player::player()
{
    posX = 0;
    posY = 0;
    posZ = 0;

    w = 0;
    h = 0;

    score = 0;

    lives = 0;

    forceX = 0;
    forceY = 0;
}


bool polaris::player::loadimg(char* filename)
{
    if(gfx = SDL_LoadBMP(filename))
    {
            w = gfx->w;
            h = gfx->h;

            Uint32 colorkey = SDL_MapRGB(gfx->format, 0, 0, 255);
            SDL_SetColorKey( gfx, SDL_SRCCOLORKEY| SDL_RLEACCEL, colorkey );

            return true;
    }
    else return false;
}

bool polaris::player::colli(polaris::player *other)
{
        if(other->posX+other->w > this->posX
	&& other->posX < this->posX
        && other->posY    <   this->posY+this->h
        && other->posY+ other->h    >  this->posY) return true;

        return false;
}

